package zt

import "time"

// GetThisMonday
// Description 获取本周一的日期
// author: sagit
// date: 2022/2/11 0:06
// params:
// return:
func GetThisMonday() string {
	now := time.Now()
	offset := int(time.Monday - now.Weekday())
	if offset > 0 {
		offset = -6
	}
	weekStart := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset)
	var thisMonday string
	thisMonday = weekStart.Format("2006-01-02")

	return thisMonday
}

// GetThisSunday
// Description 获取本周日的日期
// author: sagit
// date: 2022/2/11 0:06
// params:
// return:
func GetThisSunday() string {
	thisMonday := GetThisMonday()
	timeMonday, _ := time.Parse("2006-01-02", thisMonday)
	timeSunday := timeMonday.AddDate(0, 0, 6)
	thisSunday := timeSunday.Format("2006-01-02")

	return thisSunday
}
